// 返回一个数组，取值在min-max之间，并且不重复
export function randomList(min, max, n) {
	if (min > max) return [];
	let arr = [];
	let list = [];
	let num = n;
	for (let i=0;i<=max - min;i++){
		arr.push(min+i);
	}
	while(num > 0) {
		let item = arr[RandomNumBoth(0, arr.length - 1)];
		list.push(item);
		arr = arr.filter(t => t != item);
		num--;
	}
	return list;
}
function RandomNumBoth(Min,Max){
    var Range = Max - Min;
    var Rand = Math.random();
    var num = Min + Math.round(Rand * Range); //四舍五入
    return num;
}

export function renderTime(n) {
	let t = n / 1000;
	let h = parseInt(t / 60 / 60);
	let m = parseInt(t / 60);
	let s = t % 60;
	if (h > 0) {
		return `${pad(h)}:${pad(m)}:${pad(s)}`;
	} else {
		return `${pad(m)}:${pad(s)}`;
	}
}
function pad(n){
	return (parseInt(n) + '').padStart(2, '0');
}
